package main

import (
	"fmt"
	"github.com/jinzhu/gorm"
)

func main() {
	dsn := "user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local"
	open, err := gorm.Open("mysql", dsn)
	if err != nil {
		return
	}
	query, err := open.DB().Query("SELECT * FROM test1")
	if err != nil {
		return
	}
	columns, err := query.Columns()
	if err != nil {
		return
	}
	for index, value := range columns {
		fmt.Println(index)
		fmt.Println(value)
	}
}
